home *** CD-ROM | disk | FTP | other *** search
Wrap
<?xml version="1.0" encoding="utf-8"?> <html><head><title>Cos-Function [Runtime]</title><meta name="filename" content="text/sbasic/common/03080102"/><meta name="language" content="en-US"/><help:css-file-link xmlns:help="http://openoffice.org/2000/help"/><!--The CSS style header method for setting styles--><style type="text/css"> p.P1{ } p.P2{ } span.T1{ font-weight:bold;} </style></head><body> <help:to-be-embedded Eid="cos" xmlns:help="http://openoffice.org/2000/help"> <p class="Head1"><help:link Id="66601">Cos-Function [Runtime]</help:link></p> <p class="Paragraph">Calculates the cosine of an angle. The angle is specified in radians. The result lies between -1 and 1.</p> </help:to-be-embedded> <p class="Paragraph">Using the angle Alpha, the Cos-Function calculates the ratio of the length of the side adjacent to the angle, divided by the length of the hypotenuse in a right-angled triangle.</p> <p class="Paragraph">Cos(Alpha) = Adjacent/Hypotenuse</p> <p class="Paragraph"><span class="T1">Syntax</span>:</p> <p class="Paragraph">Cos (Number) <help:key-word value="Cos" tag="kw66601_1" xmlns:help="http://openoffice.org/2000/help"/></p> <p class="Paragraph"><span class="T1">Return value</span>:</p> <p class="Paragraph">Double</p> <p class="Paragraph"><span class="T1">Parameter</span>:</p> <p class="Paragraph">Number: Numeric expression that specifies an angle in radians, for which to calculate the cosine.</p> <p class="Paragraph">To convert degrees to radians, multiply degrees by pi/180. To convert radians to degrees, multiply radians by 180/pi.</p> <p class="Paragraph">degree=(radian*180)/pi</p> <p class="Paragraph">radian=(degree*pi)/180</p> <p class="Paragraph">Pi is here the fixed circle constant with the value 3.141592657... .</p> <p class="P2">Example:</p> <p class="PropText">REM The following example allows for a right-angled triangle the input of</p> <p class="PropText">REM secant and angle (in degrees) and calucates the length of the hypotenuse:</p> <p class="PropText">Sub ExampleCosinus</p> <p class="PropText">REM Pi = 3.1415926</p> <p class="PropText">Dim d1 as Double, dAngle as Double</p> <p class="PropText">d1 = InputBox$ (""Enter the length of the adjacent side: ","Adjacent")</p> <p class="PropText">dAngle = InputBox$ ("Enter the angle Alpha (in degrees): ","Alpha")</p> <p class="PropText">Print "The length of the hypothenuse is"; (d1 / cos (dAngle * Pi / 180))</p> <p class="PropText">End Sub</p> <p class="PropText"/> </body></html>